package com.xoa.controller.event;

import com.xoa.model.event.TimeLine;
import com.xoa.model.event.TimelineEvent;
import com.xoa.service.event.TimeLineEventService;
import com.xoa.util.ToJson;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by 张丽军 on 2017/8/30.
 * 事件管理数据接口控制器
 */
@RestController
@RequestMapping("/timeLineEvent")
public class TimeLineEventController {
    @Autowired
    TimeLineEventService timeLineEventService;

    /**
     * 创建作者:   张丽军
     * 创建日期:   2017-8-31 下午16:22:25
     * 方法介绍:   查看事件管理列表信息
     * @param request
     * @param timelineEvent
     * @return
     */
    @ResponseBody
    @RequestMapping("/getEventList")
    public ToJson<TimelineEvent> getEventList(HttpServletRequest request,TimelineEvent timelineEvent,TimeLine timeLine){
      return timeLineEventService.getEventList(request,timelineEvent,timeLine);
    }

    /**
     * 创建作者:   张丽军
     * 创建日期:   2017-8-31 下午16:52:25
     * 方法介绍:   根据uuid查看详细信息
     * @param request
     * @param uuid
     * @return
     */
    @ResponseBody
    @RequestMapping("/getEventDetailByUuid")
    public ToJson<TimelineEvent> getEventDetailByUuid(HttpServletRequest request,String uuid){
        return timeLineEventService.getEventDetailByUuid(request,uuid);
    }

    /**
     * 创建作者:   张丽军
     * 创建日期:   2017-8-31 下午17:22:25
     * 方法介绍:   修改事件信息
     * @param request
     * @param timelineEvent
     * @return
     */
    @ResponseBody
    @RequestMapping("/updateInfor")
    public ToJson<TimelineEvent> updateInfor(HttpServletRequest request,TimelineEvent timelineEvent){
        return timeLineEventService.updateInfor(request,timelineEvent);
    }

    /**
     * 创建作者:   张丽军
     * 创建日期:   2017-8-31 下午17:32:25
     * 方法介绍:   新建事件信息
     * @param request
     * @param timelineEvent
     * @return
     */
    @ResponseBody
    @RequestMapping("/addEventInfor")
    public ToJson<TimelineEvent> addEventInfor(HttpServletRequest request, TimelineEvent timelineEvent,TimeLine timeLine){
        return timeLineEventService.addEventInfor(request,timelineEvent,timeLine);
    }

    /**
     * 创建作者:   张丽军
     * 创建日期:   2017-8-31 下午17:42:25
     * 方法介绍:   根据uuid删除事件信息
     * @param request
     * @param uuid
     * @return
     */
    @ResponseBody
    @RequestMapping("/deleteEventByUuid")
    public ToJson<TimelineEvent> deleteEventByUuid(HttpServletRequest request,String uuid){
        return timeLineEventService.deleteEventByUuid(request,uuid);
    }
}
